<template>
  <el-input placeholder="请输入" v-model="url">
    <el-select v-model="method" style="width:86px" slot="prepend" placeholder="请选择">
      <el-option label="POST" value="post"></el-option>
      <el-option label="GET" value="get"></el-option>
    </el-select>
  </el-input>
</template>

<script>
export default {
  props: ['value'],
  data () {
    return {
      url: '',
      method: ''
    }
  },
  mounted () {
    const { url = '', method = '' } = this.value || {}
    this.url = url
    this.method = method
  },
  watch: {
    url () {
      this.$emit('input', { url: this.url, method: this.method })
    },
    method () {
      this.$emit('input', { url: this.url, method: this.method })
    }
  }
}
</script>